package leetcode;

public class _1839 {
    /**
     *  所有元音按顺序排布的最长子字符串
     */
    class Solution {
        public int longestBeautifulSubstring(String word) {
            int n = word.length();
            int maxNum =0;
            int i=0;

            while(i<n){
                char c = word.charAt(i);
                int num = 0;
                int type =1;
                while(i<n&&(word.charAt(i)-c)>=0){
                    num++;
                    if(word.charAt(i)-c>0){
                        type++;
                    }
                    c=word.charAt(i);
                    i++;
                }
                if(type==5)
                    maxNum = Math.max(maxNum,num);
            }
            return maxNum;
        }
    }
}
